Skip to content

Fix alcatel_sros sh svc id int - names w/ spaces - #2344

Open
jorlandobr wants to merge 5 commits into
networktocode:masterfrom
jorlandobr:interface-name-with-spaces
Open

Fix alcatel_sros sh svc id int - names w/ spaces#2344
jorlandobr wants to merge 5 commits into
networktocode:masterfrom
jorlandobr:interface-name-with-spaces

Conversation

@jorlandobr

@jorlandobr jorlandobr commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Found interface names with spaces. Modified template and added test cases

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mjbear mjbear changed the title Interfaces names with spaces Fix alcatel_sros sh svc id - int names w/ spaces Aug 16, 2026
@mjbear mjbear changed the title Fix alcatel_sros sh svc id - int names w/ spaces Fix alcatel_sros sh svc id int - names w/ spaces Aug 16, 2026
@mjbear

mjbear commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

@jorlandobr
I pushed a change to the interface_name regex that simplifies the regex pattern.

Please feel free to test against more live gear.
Thank you! 🙂

@jorlandobr

Copy link
Copy Markdown
Contributor Author

@mjbear , the modification works ok! :-)

@matt852

matt852 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Recommendation: Changes Suggested

Breaking Change: No

Thanks @jorlandobr — one suggestion and two questions:

  • Use the regex form this vendor already uses for names with spaces. (\S.+\S) needs at least 3 characters, so a 1- or 2-character interface name (l3, e1, a) now fails to parse instead of matching as it did before (as per your past PR Support Alcatel service service-using names with spaces #2152)

    In ntc_templates/templates/alcatel_sros_show_service_id_interface.textfsm, the Value declaration:

    -Value Required INTERFACE_NAME (\S.+\S)
    +Value Required INTERFACE_NAME (\S+(?:\s+\S+)*)
  • Optional — the - placeholder is captured as an address. Was this intentional? The Loopback 10 loop 2 row has no address, so the parser returns ip_address: ["-"]. Adding an ignore rule for that row returns an empty list instead:

    In the Interface state:

       ^${INTERFACE_NAME}\s+${ADMIN_STATE}\s+${OPER_STATE_V4}\/${OPER_STATE_V6}\s+${TYPE}\s+${PORT_SAP_ID}
    +  ^\s+-\s+-\s*$$
       ^\s+${IP_ADDRESS}\s+${PFX_STATE}

    And the matching fixture entry in show_service_id_interface_with_spaces.yml:

    -    ip_address:
    -      - "-"
    +    ip_address: []
         oper_state_v4: "Down"
         oper_state_v6: "Down"
    -    pfx_state:
    -      - "-"
    +    pfx_state: []
  • Optional — one question on the new .raw file. The existing show_service_id_interface.raw starts with a blank line and the new one starts at the === banner — was that blank line absent in the output you captured?

Thanks!
(review written by Claude, modified by me)

@jorlandobr

jorlandobr commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@matt852 , missed the small named interfaces. I am on vacation and don't have acces in this period to live equipment, so I used just the raw data that I have, just a small sample.

About the placeholder, I prefer to capture the output as it is and treat it later in my programs. I don't now... maybe for some cases could make a difference (for the user) having an empty output and one that has a marker

The empty line at the beggining was a mistake when copy/pasting the output for testing the template

@matt852

matt852 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

@jorlandobr Sounds good, feel free to push the updates once your back from vacation. Thank you for your submission!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants